package com.ebs.md.fxmonitor.marketmonitor.alert;

/**
 * Perforce Revision:
 *  $File: //depot/MarketData/fxmonitor/main/src/main/java/com/ebs/md/fxmonitor/marketmonitor/alert/SpoofingBySizeMessageCreator.java $
 *  $Revision: #2 $  $Change: 116110 $  $DateTime: 2012/10/23 08:23:43 $  $Author: Aviad.Yosef $
 */

import java.util.List;

import com.ebs.market.monitor.MarketMonitor.EventType;
import com.ebs.market.monitor.MarketMonitor.MarketIdentfier;
import com.ebs.market.monitor.MarketMonitor.OrderDetail;
import com.ebs.market.monitor.MarketMonitor.SpoofingBySizeEvent;
import com.ebs.md.fxmonitor.marketmonitor.model.SpoofBySizeSingleFact;


public class SpoofingBySizeMessageCreator
extends AbstractAlertMessageCreatorBySingleFact<SpoofingBySizeEvent, SpoofBySizeSingleFact>
{

	public SpoofingBySizeMessageCreator(List<SpoofBySizeSingleFact> dataList) {
		super(dataList);
	}

	@Override
	public SpoofingBySizeEvent createAlertObject() {
		SpoofingBySizeEvent.Builder builder = SpoofingBySizeEvent.newBuilder();

		final SpoofBySizeSingleFact firstDataElement = getFirstDataElement();
		{
		MarketIdentfier mi = gpbBuildMarketIdentifier(firstDataElement.getPair());
		builder.setMarketId(mi);
		}
		final String eventId = createEventIdByQuoteId(firstDataElement, firstDataElement.getTimestamp());
		builder.setEventId(eventId);
		builder.setEventTime(eventTimeMillis);
		builder.setConfigInstanceName(firstDataElement.getConfigInstanceName());
		{
		OrderDetail od = gpbBuildOrderDetail(firstDataElement);
		builder.setAffectingQuote(od);
		}

		builder.setQuotePriceLevel(firstDataElement.getPosition());
		builder.setQuoteLifeTime  (firstDataElement.getLifeTime());
		
		return builder.build();
	}

	@Override	
	public EventType getEventType() {
		return EventType.SPOOFING_BY_SIZE;
	}

}
